<?php
/**
 * DotHerbert
 *
 * @package    objects
 * @subpackage factory
 * @copyright  2009 extreme-programmers
 * @license    http://dotherbert.extreme-programmers.com/license   BSD License
 * @version    $Id:$
 */

namespace dotherbert\objects\factory;

/**
 * Abstract object factory
 *
 * @package    objects
 * @subpackage factory
 * @author     Johannes Trink <johannes.trink@extreme-programmers.com>
 */
abstract class AbstractObjectFactory
{
    private $objectsDefinition, $parser;

    /**
     * Set parser
     *
     * @param dotherbert\objects\factory\parser\Parser $parser
     * @return void
     */
    public function setParser(parser\Parser $parser)
    {
        $this->parser = $parser;
    }

    /**
     * Get parser
     *
     * @return dotherbert\objects\factory\parser\Parser
     */
    public function getParser()
    {
        if (null === $this->parser) {
            $this->parser = $this->getDefaultParser();
        }
        return $this->parser;
    }

    /**
     * Get default parser
     *
     * @return  dotherbert\objects\factory\parser\Parser
     */
    abstract public function getDefaultParser();
}